/**
 * User: alesj
 * Date: 15.1.2006
 * Time: 14:35:24
 * 
 * (C) Genera Lynx d.o.o.
 */

package com.alesj.blueberry.spring.lotto.impl;

import com.alesj.blueberry.spring.lotto.JdbcDAO;
import com.alesj.blueberry.spring.sms.impl.AbstractValidator;
import com.alesj.blueberry.spring.validation.ValidationResult;

/**
 * @author <a href="mailto:ales.justin@genera-lynx.com">Ales Justin</a>
 */
public class IdleValidator extends AbstractValidator {

    private JdbcDAO jdbcDAO;

    public IdleValidator() {
        setKey("validator.invalid.idle");
    }

    public ValidationResult validate(long timestamp, String number, String message) {
        if (jdbcDAO.findIsIdle(timestamp)) {
            return new ValidationResult(getKey(), new Object[]{timestamp, number});
        }
        return null;
    }

    public void setJdbcDAO(JdbcDAO jdbcDAO) {
        this.jdbcDAO = jdbcDAO;
    }

}
